﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EbayMaster
{
    public partial class FrmSetShippingCost : Form
    {
        public EbayTransactionType trans = null;

        public FrmSetShippingCost()
        {
            InitializeComponent();
        }

        private void FrmSetShippingCost_Load(object sender, EventArgs e)
        {
            if (trans == null)
                return;

            this.labelShippingService.Text = trans.ShippingService;
            this.textBoxShippingCost.Text = StringUtil.GetSafeString(trans.ShippingCost);
        }

        private void buttonSetShippingCost_Click(object sender, EventArgs e)
        {
            if (trans == null || trans.TransactionId == 0)
            {
                MessageBox.Show("无订单信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string shippingCostStr = this.textBoxShippingCost.Text;
            if (shippingCostStr == null || shippingCostStr.Trim() == "")
            {
                MessageBox.Show("输入错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            double shippingCost = StringUtil.GetSafeDouble(shippingCostStr);
            EbayTransactionDAL.updateTransactionShippingCost(trans.TransactionId, shippingCost);

            //MessageBox.Show("更新运费成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Close();
        }
    }
}
